import { CDItemData } from "../../cache/CDItem/CDItemData";
type int = number;
//class LeftTimeCd
    
    export  class LeftTimeCd /* flash.text.TextField */
    {
        constructor()
        {
            
            mouseEnabled = false;
            return;
        }

        public get isPlaying(): Boolean
        {
            return this._cdTime && this._cdTime.isCoolDown;
        }

        public get cdTime(): CDItemData
        {
            return this._cdTime;
        }

        public set cdTime(arg1: CDItemData)
        {
            this.clearLeftTime();
            this._cdTime = arg1;
            this._cdTime.addLeftTimeCall(this.onCDLeftTimeHandler);
            return;
        }

        public onCDLeftTimeHandler(arg1: int): void
        {
            var loc2=NaN;
            var loc1=0;
            if (arg1 <= 0) 
            {
                this.dispatchEvent(new Object /* flash.events.Event */(flash.events.Event.COMPLETE));
                this.clearLeftTime();
            }
            else 
            {
                loc2 = arg1 / 1000;
                loc1 = Math.ceil(loc2);
                if (loc1 != this._currentNumber) 
                {
                    if (loc1 >= 60) 
                    {
                        text = Math.floor(loc1 / 60) + "m";
                    }
                    else 
                    {
                        text = loc1.toString();
                    }
                    this._currentNumber = loc1;
                }
            }
            return;
        }

        public clearLeftTime(): void
        {
            if (this._cdTime) 
            {
                this._cdTime.removeLeftTimeCall(this.onCDLeftTimeHandler);
            }
            this._cdTime = null;
            text = "";
            this._currentNumber = 0;
            return;
        }

        /* internal */ /* var */_cdTime: CDItemData;

        /* internal */ /* var */_maskBitmap: Object /* flash.display.Bitmap */;

        /* internal */ /* var */_currentNumber: number=0;
    }
